package com.tledu.springboot02.controller;

import com.tledu.springboot02.model.User;
import com.tledu.springboot02.service.IUserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author Antg
 * @date 2021/8/24  16:04
 */
@Controller
@RequestMapping("/user")
@AllArgsConstructor
public class UserController {
    private final IUserService userService;
    @GetMapping("/list")
    public String findAll(Model model){
        List<User> list = userService.findAll();
        model.addAttribute("list",list);
        return "user/user";
    }
}
